#include "ThreadPool.hpp"
#include "Task.hpp"
#include <ctime>

int main()
{
    ThreadPool<Task>* tp = new ThreadPool<Task>();
    tp->Init();
    tp->Start();
    srand(time(nullptr));
    int cnt = 10;
    while (cnt--)
    {
        int x = rand() % 10 + 1;
        usleep(100);// 降低x y 的重复率
        int y = rand() % 10 + 1;
        Task t(x,y);
        //std::cout << t.debug() << std::endl;
        LOG(INFO, "Main thread push a task: %s\n", t.debug().c_str());
        tp->PushTask(t);
        sleep(1);
    }

    tp->Stop();
    sleep(2);
    return 0;
}